package com.cw2.behavioral.mediator;

import java.util.Objects;

/**
 * 塔台：中介者
 * 网状变为星状
 */
public class ControlTower {

    private boolean canDo = true;

    // 接受请求
    public void acceptRequest(Captain captain, String action){
        if (Objects.equals("fly", action) || Objects.equals("land", action)){
            if (Objects.equals(canDo , true)){
                System.out.println("允许起飞");
                canDo = false;
            }else {
                System.out.println("不允许起飞");
            }
        }else if (Objects.equals("success", action)){
            canDo = true;
        }
    }
}
